import request from '@/utils/request'

// 创建检验方案
export function createInspectScheme(data) {
  return request({
    url: '/qms/inspect-scheme/create',
    method: 'post',
    data: data
  })
}

// 更新检验方案
export function updateInspectScheme(data) {
  return request({
    url: '/qms/inspect-scheme/update',
    method: 'put',
    data: data
  })
}

// 删除检验方案
export function deleteInspectScheme(id) {
  return request({
    url: '/qms/inspect-scheme/delete?id=' + id,
    method: 'delete'
  })
}

// 获得检验方案
export function getInspectScheme(id) {
  return request({
    url: '/qms/inspect-scheme/get?id=' + id,
    method: 'get'
  })
}

// 获得检验方案
export function getInspectSchemeByItem(itemId, type) {
  return request({
    url: '/qms/inspect-scheme/info?itemId=' + itemId + '&inspectType=' + type,
    method: 'get'
  })
}

// 获得检验方案分页
export function getInspectSchemePage(query) {
  return request({
    url: '/qms/inspect-scheme/page',
    method: 'get',
    params: query
  })
}

// 导出检验方案 Excel
export function exportInspectSchemeExcel(query) {
  return request({
    url: '/qms/inspect-scheme/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
